package plugins.lxfa.No3Swf.view
{
	import core.manager.MainSystem;
	import core.manager.playerManager.musicPlayerManager.BackGroundMusicManager;
	import core.manager.playerManager.swfManager.SwfManager;
	import core.manager.playerManager.swfManager.SwfManagerEvent;
	import core.manager.pluginManager.PluginManager;
	import core.manager.sceneManager.SceneChangeEvent;
	import core.manager.sceneManager.SceneManager;
	
	import flash.events.ProgressEvent;
	
	import memory.MemoryRecovery;
	import memory.MyGC;
	
	import mx.core.Application;
	import mx.core.UIComponent;
	
	import plugins.lxfa.animatePlayer.AnimatePlayer;
	
	import view.loadings.LoadingWaveRota;
	public class No3SwfBase extends UIComponent
	{
		private var loading_mc:LoadingWaveRota;//用于显示进度
		public function No3SwfBase()
		{
			MainSystem.getInstance().isBusy=true;
			SwfManager.getInstance().showSwfById("dd");
			SwfManager.getInstance().addEventListener(SwfManagerEvent.READY,allComplete);
		}
		private function allComplete(e:SwfManagerEvent):void
		{
			MainSystem.getInstance().isBusy=false;
			PluginManager.getInstance().removePluginById("No3Module");
            MainSystem.getInstance().showPluginById("MainMenuBottomModule");
			MainSystem.getInstance().showPluginById("MainMenuTopModule");
			AnimatePlayer.getInstance().showAnimate(54);
			BackGroundMusicManager.getInstance().loadBackGroundMusic("http://audio.pavilion.expo.cn/p5006/audio/backgroundmusic/bg1.mp3");
			SceneManager.getInstance().addEventListener(SceneChangeEvent.COMPLETE,removeCurrentModule);
			MemoryRecovery.getInstance().gcFun(SwfManager.getInstance(),SwfManagerEvent.COMPLETE,allComplete);
		}
		private function on_progress(e:ProgressEvent):void
		{
			loading_mc.updateByProgressEvent(e);//更新显示的进度
		}
		private function removeCurrentModule(e:SceneChangeEvent):void
		{
			 PluginManager.getInstance().removePluginById("No3SwfModule");
		}
		public function dispose():void
		{
			MemoryRecovery.getInstance().gcFun(SceneManager.getInstance(),SceneChangeEvent.COMPLETE,removeCurrentModule);
			SwfManager.getInstance().removeSwfById("dd");
			MyGC.gc();
		}
	}
}